{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Url::build($Request.action)}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>商品标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="goods_name" datatype="*" nullmsg="请填写商品标题">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>商品短标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="short_name" datatype="*" nullmsg="请填写商品短标题">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>选择分类：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select class="select-box" name="cate_id">
                    <option value="0">-- 请选择分类 --</option>
                    {volist name="cates" id="vo"}
                        <option value="{$vo.cate_id}">{$vo.name}</option>
                    {/volist}
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>图片1：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="goodspic[]" id="upload-1" placeholder="请点击后面的上传按钮" style="width: 70%">
                <button type="button" class="btn btn-primary radius" onclick="layer_open('文件上传','{:\\think\\Url::build(\'Upload/index\', [\'id\' => \'upload-1\'])}')">上传</button>
                <!--<a onclick="$(this).attr('href', $('#upload-1').val())" type="button" class="btn btn-success radius" data-lightbox="preview">预览</a>-->
            </div>
            <div class="col-xs-3 col-sm-3">
                <img src="" height="80" width="100" id="preimg-upload-1"  alt="预览图片">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red"></span>图片2：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="goodspic[]" id="upload-2" placeholder="请点击后面的上传按钮" style="width: 70%">
                <button type="button" class="btn btn-primary radius" onclick="layer_open('文件上传','{:\\think\\Url::build(\'Upload/index\', [\'id\' => \'upload-2\'])}')">上传</button>
                <!--<a onclick="$(this).attr('href', $('#upload-2').val())" type="button" class="btn btn-success radius" data-lightbox="preview">预览</a>-->
            </div>
            <div class="col-xs-3 col-sm-3">
                <img src="" height="80" width="100" id="preimg-upload-2"  alt="预览图片">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red"></span>图片3：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="goodspic[]" id="upload-3" placeholder="请点击后面的上传按钮" style="width: 70%">
                <button type="button" class="btn btn-primary radius" onclick="layer_open('文件上传','{:\\think\\Url::build(\'Upload/index\', [\'id\' => \'upload-3\'])}')">上传</button>
                <!--<a onclick="$(this).attr('href', $('#upload-3').val())" type="button" class="btn btn-success radius" data-lightbox="preview">预览</a>-->
            </div>
            <div class="col-xs-3 col-sm-3">
                <img src="" height="80" width="100" id="preimg-upload-3"  alt="预览图片">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea name="goods_desc" class="textarea valid" placeholder="说点什么...最少输入10个字符" onkeyup="textarealength(this,100)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>售卖方式：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">

                <div class="radio-box">
                    <input type="radio" name="sale_type" id="sale-1" value="2">
                    <label for="sale-1">按斤卖</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="sale_type" id="sale-2" value="1">
                    <label for="sale-2">按个卖</label>
                </div>

            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>价格：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" style="width: 200px;" name="price" datatype="*" nullmsg="请填写商品个卖单价">&nbsp;元
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>状态：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">
                <div class="radio-box">
                    <input type="radio" checked name="status" id="status-1" value="1">
                    <label for="status-1">立即上架</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="status" id="status-0" value="0">
                    <label for="status-0">暂不上架</label>
                </div>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>详情：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <script id="contents" name="contents" type="text/plain"></script>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/showdown/1.4.2/showdown.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>

<script>
    $(function () {
        $("#form").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                ajax_progress(ret,function () {
                    $("#encode").html(ret.data.encode);
                    $("#decode").html(ret.data.decode);
                });

                // 提交成功
                if(ret.code==0){
                    parent.location.reload();
                } else {
                    layer.alert(ret.msg);
                    return false;
                }

            }
        });


        var ue = UE.getEditor('contents',{
            serverUrl:'{:\\think\\Url::build("Ueditor/index")}'
        });

    })
</script>
{/block}